package org.price.sql.repo.session.db.dialect;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.price.sql.repo.documents.config.SqlType;

public interface Dialect<D, P> {

    public String getNormalizedConstraintName(String originalName)
            throws SQLException;

    public String getNormalizedColumnName(String originalName)
            throws SQLException;

    public String getNormalizedTableName(String originalName)
            throws SQLException;

    public void reset();

    public D[] getTables() throws SQLException;

    public int createIndex(String name, String tableName, String type,
            String... propNames) throws SQLException;

    public int dropIndex(String name, String tableName) throws SQLException;

    public int createUnique(String name, String tableName, String type,
            String... propNames) throws SQLException;

    public int dropUnique(String name, String tableName) throws SQLException;

    public int createTable(String name) throws SQLException;

    public int dropTable(String name) throws SQLException;

    public int createColumn(String tableName, P property) throws SQLException;

    public int dropColumn(String tableName, P property) throws SQLException;

    public String getSqlStringFromSqlType(String tableName, P prop)
            throws SQLException;

    public Object getValue(ResultSet rs, SqlType type);

    public Object setValue(ResultSet rs, SqlType type);

    // Temp stuff
    public int createPrimaryKey(String tableName, String name, String... props)
            throws SQLException;

    public int createForeignKey(String name, String primaryTable,
            String ptProperty, String secondaryTable, String stProperty)
            throws SQLException;

    public int dropForeignKey(String tableName, String name)
            throws SQLException;

    public int dropPrimaryKey(String tableName, String name)
            throws SQLException;

}
